#include<iostream>
#include<cstring>
#include<string>
using namespace std;
const int N = 5e4 + 10;
int arr[N];
int tree[N];
int t, n;
int lowbit(int x)
{
	return x & -x;
}
void add(int x, int v)
{
	for (int i = x; i <= n; i+=lowbit(i)) {
		tree[i] += v;
	}
}

int query(int x)
{
	int ans = 0;
	for (int i = x; i; i -= lowbit(i)) {
		ans += tree[i];
	}
	return ans;
}
int main()
{
	scanf("%d", &t);
	for (int k = 1; k <= t; k++) {
		memset(tree, 0, sizeof(tree));
		memset(arr, 0, sizeof(arr));
		printf("Case %d:\n", k);
		scanf("%d", &n);
		for (int i = 1; i <= n; i++) {
			scanf("%d", &arr[i]);
			add(i, arr[i]);
		}
		string q;
		while (cin >> q) {
			if (q == "End") {
				break;
			}
			else if (q == "Add") {
				int a, b;
				scanf("%d%d", &a, &b);
				add(a, b);
			}
			else if (q == "Sub") {
				int a, b;
				scanf("%d%d", &a, &b);
				add(a, -b);
			}
			else {
				int a, b;
				scanf("%d%d", &a, &b);
				printf("%d\n", query(b) - query(a - 1));
			}
		}
	}
	return 0;
}